package com.zhl.Test;

import java.util.Scanner;

public class TestDemo1 {
    public static void main(String[] args) {
        //目的：买飞机票
        //需要输入数据：月份、舱位类型
        //                  根据输入的数据进行判断，输出相应的优惠价格
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入月份：");
        int month = sc.nextInt();
        System.out.println("请输入舱位类型：");
        String seatType = sc.next();
        System.out.println("请输入票价：");
        double price = sc.nextDouble();

        sc.close();
        price = BuyTicket(month, price ,seatType);
        System.out.println("票价为：" + price);

    }

    public static double BuyTicket(int month, double price,String seatType){

        if (month >= 5 && month <= 10)
        {
            //旺季
            switch(seatType) {
                case "头等舱":
                    System.out.println("九折优惠！");
                    price *= 0.9;
                    break;
                case "经济舱":
                    System.out.println("八五折优惠！");
                    price *= 0.85;
                    break;
            }
        }else{
            //淡季
            switch(seatType) {
                case "头等舱":
                    System.out.println("七折优惠！");
                    price *= 0.7;
                    break;
                case "经济舱":
                    System.out.println("六点五折优惠！");
                    price *= 0.65;
                    break;
            }
        }
        return price;
        }

}


